Load necessary packages
library(sf)
library(tidyverse)
library(ggthemes)
library(ggspatial)
library(here)
Read in data
Datasets come from The City of Miami’s Open Data Portal
historic_districts <- st_read(here("Data", "Historic_Districts.geojson"))
## Reading layer `Historic_Districts' from data source
## `/Users/matt/Desktop/Spatial Analysis/Spatial-Analysis-Week1/Data/Historic_Districts.geojson'
## using driver `GeoJSON'
## Simple feature collection with 12 features and 12 fields
## Geometry type: POLYGON
## Dimension: XY
## Bounding box: xmin: -80.21473 ymin: 25.76818 xmax: -80.17453 ymax: 25.84764
## Geodetic CRS: WGS 84
landmarks <- st_read(here("Data", "Landmarks.geojson"))
## Reading layer `Landmarks' from data source
## `/Users/matt/Desktop/Spatial Analysis/Spatial-Analysis-Week1/Data/Landmarks.geojson'
## using driver `GeoJSON'
## Simple feature collection with 765 features and 17 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -80.31077 ymin: 25.7242 xmax: -80.12542 ymax: 25.85526
## Geodetic CRS: WGS 84
This plot shows the locations of all landmarks as well as the outline of historic districts in Miami, Florida. This was an attempt to create a legible plot without using color, though the only black & white basemaps are visually quite busy and detract from the legibility of the plotted shapes and lines.
ggplot() +
annotation_map_tile(zoomin = 0, progress = "none", type = "osmgrayscale") +
geom_sf(data = historic_districts, color = "Black", fill = NA, size = 0.5) +
geom_sf(data = landmarks, shape = 17, size = 2, alpha = 0.35, color = "Black") +
theme_void()
This plot shows the different types of nightlife or entertainment venues relative to the historic districts in Miami, Florida. To do this, we filtered the ‘landmarks’ dataframe into a new ‘entertainment’ dataframe that only includes relevant sites to be plotted. We used the “cartodark” basemap type as a nod to the nightlife theme and to accentuate the different colors and shapes of the variables plotted on top.
entertainment <- landmarks %>%
filter( LMCNAME == "Night Club" |
LMCNAME == "Adult Entertainment" |
LMCNAME == "Theater/Performing Arts" |
LMCNAME == "Sport Complex" |
LMCNAME == "Movie Theater" |
LMCNAME == "Museum" |
LMCNAME == "Special Events" |
LMCNAME == "Stadium"
)
ggplot() +
annotation_map_tile(zoomin = 0, progress = "none", type = "cartodark") +
geom_sf(data = historic_districts, color = NA, alpha = 0.4, aes(fill = "Historic Districts")) +
geom_sf(data = entertainment, aes(color = LMCNAME, shape = LMCNAME), size = 2.5) +
scale_shape_manual(values=seq(0,7)) +
scale_fill_manual(values = "DarkGrey") +
theme_void() +
labs(caption = "Map tiles and data by Carto", color = " ", shape = " ", fill = " ")
This plots adds the dimension of elevation while still trying to retain the street information by overlaying the “cartolight” and “hillshade” basemaps. Equally, to try and retain some of the shading information while still delineating the historic districts, the polygons were drawn both as a fill with high transparency as well as an opaque outline of the same color. Also added north arrow and scale bar.
ggplot() +
annotation_map_tile(zoomin = 0, progress = "none", type = "hillshade") +
annotation_map_tile(zoomin = 0, progress = "none", type = "cartolight", alpha = 0.4) +
geom_sf(data = historic_districts, alpha = 0.5, color = NA, aes(fill = HD_NAME)) +
geom_sf(data = historic_districts, fill = NA, size = .8, aes(color = HD_NAME)) +
geom_sf(data = landmarks, size = 1.5, alpha = 0.2, color = "Black") +
labs(color = " ", fill = " ") +
annotation_north_arrow(which_north = "true", height = unit(0.75, "cm"), width = unit(0.75, "cm"), style = north_arrow_minimal) +
annotation_scale( height = unit(0.125, "cm"), pad_x = unit(1.25, "cm")) +
theme_void()